package com.bw.aop;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class Myaop {



    @Around("execution(* com.bw.controller.*.*(..))")
    public Object aop(ProceedingJoinPoint joinPoint) throws Throwable {

        System.out.println("方法名"+joinPoint.getSignature().getName());
        System.out.println("方法入参"+ joinPoint.getArgs());
//        System.out.println("方法入参"+ JSON.toJSONString(joinPoint.getArgs(), SerializerFeature.IgnoreNonFieldGetter));

        Object proceed = joinPoint.proceed();
        System.out.println("方法返回值"+ JSON.toJSONString(proceed));

        return proceed;
    }
}
